package com.anjubao.parking.municipal.parkinglot.util;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author zhuchunfeng
 * @date 2019/7/9 9:19
 */
@Slf4j
@Getter
@Setter
@Accessors(chain = true)
public class DateUtil {

    private static DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");


    public static String LocalDateTime2String(LocalDateTime localDateTime) {
        return localDateTime.format(dateTimeFormatter);
    }

    public static LocalDateTime string2LocalDateTime(String string) {
        return LocalDateTime.parse(string, dateTimeFormatter);
    }

}
